<template>
  <div class="form-footer">
	  <el-button type="primary" @click="submit" :loading="loading">提交</el-button>
	<el-button type="primary" @click="cancel" v-if="!hideCancel">取消</el-button>
  </div>
</template>

<script>
export default {
	name: "form-footer",
	props: {
		hideCancel: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			loading: false
		};
	},
	methods: {
		startLoading() {
			this.loading = true;
		},
		endLoading() {
			this.loading = false;
		},
		submit() {
			this.startLoading();
			this.$emit("on-submit", this.endLoading);
		},
		cancel() {
			this.$emit("on-cancel");
		}
	}
};
</script>

<style>

</style>
